package seven.service;

import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import seven.bean.model.MarketAdmin;
import seven.bean.model.MarketAdminExample;
import seven.bean.vo.PageVo;
import seven.bean.vo.param.BaseListParam;
import seven.mapper.MarketAdminMapper;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    MarketAdminMapper marketAdminMapper;
    public PageVo list(BaseListParam baseListParam){
        //然后这个地方要用到我们学的Mybatis的注册，现在先去注册MyBatis要用到的相关内容here we go
        //好难啊，记不住，照着抄吧
        //配置好了，现在开始获取内容
        //要先获取mapper
        //然后用mapper查找数据
         MarketAdminExample marketAdminExample=new MarketAdminExample();
         marketAdminExample.setOrderByClause(baseListParam.getSort()+" "+baseListParam.getOrder());
         MarketAdminExample.Criteria criteria= marketAdminExample.createCriteria();
         PageHelper.startPage(baseListParam.getPage(),baseListParam.getLimit());
         List<MarketAdmin> marketAdminList=marketAdminMapper.selectByExample(marketAdminExample);


//        MarketAdmin marketAdminList=marketAdminMapper.selectByPrimaryKey(1);

        return PageVo.list(marketAdminList);

    }
}
